<template>
  <div class="empty-back-loading-page"></div>
</template>

<script setup lang="ts">
import {
  ref,
  reactive,
  toRefs,
  watch,
  onMounted,
  getCurrentInstance
} from 'vue'
import type { ComponentInternalInstance } from 'vue'
const instance: any = getCurrentInstance() as ComponentInternalInstance;
const proxy: any = instance.proxy as any; // 访问 proxy 属性
import { useHookI18n } from '@/hooks/i18n'
const { locale, $t } = useHookI18n()
import { encryption } from "@/utils/util";
import { enCodeKey, client_id } from "@/const/const";
import { bindDD } from "@/api/user";
import { useRouter, useRoute } from "vue-router"
const router = useRouter();
const route = useRoute()
const emit = defineEmits([""])
const props = defineProps({
})

const showType = ref('')
onMounted(() => {
  if (route.query) {
    showType.value = "bind"
    let query = route.query
    let tp = {
      data: JSON.stringify(query)
    }
    let temp = encryption({
      data: tp,
      key: enCodeKey,
      param: ["data"]
    })
    bindDD({ code: temp.data, appId: client_id }).then((res) => {
      if (res.data.code != 0) {
        proxy.$notify({
          title: $t('message.prompt'),
          message: (res.data.msg),
          type: 'error',
          position: 'bottom-right'
        });
      }
      localStorage.setItem("bindRandom", "")
      router.push({
        path: '/userinfo'
      })
    }).catch((e) => {
      router.push({
        path: '/userinfo'
      })
    })
  }
})

</script>
<style lang="scss" scoped>
.empty-back-loading-page {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.8);
  background-image: url("../../../../public/jf-ui-public/img/loading.gif");
  background-repeat: no-repeat;
  background-position: center;
  background-position: center;
  background-size: 200px 160px;
}
</style>